home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 January / macformat-020.iso / Shareware City / Developers / apps.to.go / pbClock / App.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-17  |  4.4 KB  |  126 lines  |  [TEXT/MPS ]

  1. #ifndef __APPHEADER__
  2. #define __APPHEADER__
  3.  
  4. #ifndef __DTSLib__
  5. #include "DTS.Lib.h"
  6. #endif
  7.  
  8. #ifndef __PRINTING__
  9. #include <Printing.h>
  10. #endif
  11.  
  12. #ifndef __TREEOBJ__
  13. #include <TreeObj.h>
  14. #endif
  15.  
  16. /********/
  17.  
  18. #define VH_VERSION  0                /* True means to include ViewHierarchy window.             */
  19. #define DEV_VERSION 1                /* True means allow option-cmd.period escape from dialogs. */
  20.  
  21. /* If you are unfamiliar with programming with the DTS.framework, you probably want to
  22. ** read the file "=How to write your app", which is found at the same level as the
  23. ** directory for this project. */
  24.  
  25. #if defined(powerc) || defined (__powerc)
  26. #pragma options align=mac68k
  27. #endif
  28. typedef struct {
  29.     DocHeaderInfo    fhInfo;        /* Doc header info (version, print record, window loc. ) */
  30.     TreeObjHndl        root;
  31.                                 /***** Start of custom file info. *****/
  32.     long            timer;
  33. } TheDoc;
  34. #if defined(powerc) || defined(__powerc)
  35. #pragma options align=reset
  36. #endif
  37.  
  38. /* Below is the master document structure.  All DTS.framework documents use this structure.
  39. ** For each unique document type, union in a sub-structure for the document-specific
  40. ** information.  In the case of AppWannabe, there is only one known document type initially.
  41. ** The structure for this document type is defined just above.  Even though there is only one,
  42. ** it is still placed in a union.  This allows easy addition of additional document types later.
  43. ** Given a FileRec handle called frHndl, a sample dereference to the inBox field would look like:
  44. **     inBox = (*frHndl)->d.doc.inBox;
  45. **
  46. ** The fileState and connect fields are expected and managed by DTS.framework.  Also, the
  47. ** first two fields in the app-specific portion of the document are expected, namely
  48. ** the fhInfo and root fields. */
  49.  
  50. #if defined(powerc) || defined (__powerc)
  51. #pragma options align=mac68k
  52. #endif
  53. typedef struct FileRec {
  54.     FileStateRec    fileState;        /* DTS.Lib expects this structure here. */
  55.     ConnectRec        connect;        /* DTS.Lib expects this structure here. */
  56.     union {
  57.         TheDoc    doc;                /* Union in each document type here. */
  58.     } d;
  59. } FileRec;
  60. #if defined(powerc) || defined(__powerc)
  61. #pragma options align=reset
  62. #endif
  63.  
  64. /* Below is the definition of the hierarchical document's root object.  If you are using
  65. ** the hierarchical document package TreeObj, then you will need at least this object.
  66. ** TreeObj expects the first two fields to be undo and frHndl, as shown below.  You can
  67. ** add fields after these two fields.  If you use TreeObj, the root object and all of its
  68. ** children are automatically saved and read from disk.
  69. ** Note that the definition for the root object includes a prototype.  Each object is
  70. ** automatically called by DTS.framework at appropriate times.  The prototype defines the
  71. ** function that will be called for this object.  See the files "=How to write your app"
  72. ** and "=Using TreeObj.c" for more information. */
  73.  
  74. #if defined(powerc) || defined (__powerc)
  75. #pragma options align=mac68k
  76. #endif
  77. long    TRootObj(TreeObjHndl hndl, short message, long data);
  78. typedef struct {
  79.     TreeObjHndl    undo;        /* This structure may be added to, but */
  80.     FileRecHndl    frHndl;        /* these two first fields must remain. */
  81.     long        timeControl[6];
  82.     short        numMovesInTimeControl[3];
  83.     long        timeRemaining[2];
  84.     short        numMoves[2];
  85.     short        rightStart;
  86. } RootObj;
  87. #if defined(powerc) || defined(__powerc)
  88. #pragma options align=reset
  89. #endif
  90.  
  91. /********/
  92.  
  93. #define kMaxNumUndos  64
  94. #define kNumSaveUndos 8
  95.  
  96. #define kNumTreeObjs   16        /* Minimum number of objects is 16. */
  97.  
  98. #define mDerefRoot(hndl)     ((RootObj*)((*hndl) + 1))
  99.  
  100. /********/
  101.  
  102. /* These values are passed to the DTS.framework function Initialize(). */
  103. #define kMinHeap    64 * 1024        /* Needs at least 64k of heap space. */
  104. #define kMinSpace    64 * 1024        /* Needs this much after calling PurgeSpace. */
  105.  
  106.  
  107. #define kwAppWindow    (kwGrowIcon | kwHScrollLessGrow | kwVScrollLessGrow | kwVisible | kwOpenAtOldLoc)
  108.     /* Main application window has growIcon, horizontal and vertical document scrollbars,
  109.     ** is initially visible, and if the document is saved, it will open at the location
  110.     ** it was last closed at. */
  111.  
  112. #define keyAppMessage      'KMSG'         /* Custom Apple Event definitions. */
  113. #define typeAppMessage     'KMSG'
  114. #define typeTextMessage    'KTXT'
  115.  
  116. #define kDisconnectMssg    0
  117. #define kTextMssg        1
  118.  
  119. #define kVersion        100        /* Document versions, not application versions. */
  120. #define kMinVersion        100
  121. #define kMaxVersion        100
  122.  
  123. #define kMaxNumWindows        65535        /* No limit on the number of windows. */
  124.  
  125. #endif
  126.